package cn.hamster3.mc.plugin.ball.common.thread;

import cn.hamster3.mc.plugin.ball.common.api.BallAPI;
import cn.hamster3.mc.plugin.core.common.api.CoreAPI;
import redis.clients.jedis.Jedis;

public class LockUpdateThread implements Runnable {
    public static final LockUpdateThread INSTANCE = new LockUpdateThread();

    private LockUpdateThread() {
    }

    @Override
    public void run() {
        String key = "HamsterBall:ServerInfo:" + BallAPI.getInstance().getLocalServerInfo().getId();
        try (Jedis jedis = CoreAPI.getInstance().getJedisPool().getResource()) {
            jedis.expire(key, 180);
        }
    }
}
